#ifndef MOTOR_H
#define MOTOR_H

#include "struct_typedef.h"
#include "main.h"

#define DJI_MOTOR_MAX_ECD 8191
#define DJI_MOTOR_HALF_ECD 4095

typedef struct
{
	float reduction_ratio;
	float position_cnt;
	float real_speed_rpm;
	float real_ecd;
} reduct_motor_date_t;

typedef struct
{
	uint16_t ecd;
	int16_t  speed_rpm;
	int16_t  given_current;
	uint8_t  temperate;
	int16_t  last_ecd;
	reduct_motor_date_t reduct_motor_date;
} motor_measure_t;

void get_motor_measure(motor_measure_t *Motor , unsigned char rx_date[]);

void ChassisMotorCurrentSendQueue(CAN_HandleTypeDef *hcan, int stdId, short int *current, unsigned char len);

void reductMotor_ecd_measure(motor_measure_t *motor);

#endif

